<%@ page import="ro.prjmanager.core.usr.UserSession" %>

<%@ page import="ro.prjmanager.core.context.SecurityContext" %>
<%@ page import="ro.prjmanager.model.*" %>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ include file="taglibs.jsp" %>
<script type="text/javascript">
    function uploadFile(attName){
        FileUpld.upload(attName,dwr.util.getValue(attName), {callback:doPostUpload,async:false});
    }
    function doPostUpload() {
        return true;
    }

    function downloadFile(id,attName,serviceName){
        FileUpld.download(id,attName,serviceName,{callback:doPostDownload,async:false});
    }

    function doPostDownload(downloaded){

        document.getElementById("dialog").innerHTML="<div id='fileDown'  title='File view'><p><code>"+downloaded+"</code></p></div>";

//        alert($("#dialog").dialog.('isOpen'));
            $("#fileDown").dialog({
                bgiframe: true,
                height:400,
                width:600,
                modal: true,
                buttons: {
                    Ok: function() {
                        $(this).dialog('close');
                    }
                }
            });

        $("ui-widget-overlay").style="width:750px";

    }
</script>
<div id="imageHeader">
    <table style="padding: 5px; margin: 1px; width: 100%;">
        <tr>
             <%
                    if (request.getSession().getAttribute(SecurityContext.USER_KEY) != null) {
                        UserSession<Users, Projects, Svn, DataBases, Schema> userSession = (UserSession<Users, Projects, Svn, DataBases, Schema>) request.getSession().getAttribute("user");
                %>
            <td id="pageHeader"><%=userSession.getProject().getDescription()%></td>
            <%}else{%>
            <td id="pageHeader">Project Management</td>
            <%}%>
            <td id="loginInfo">


                <%
                    if (request.getSession().getAttribute(SecurityContext.USER_KEY) != null) {
                        UserSession<Users,Projects,Svn,DataBases,Schema> userSession = (UserSession<Users, Projects, Svn, DataBases, Schema>) request.getSession().getAttribute("user");
                %>
                Welcome: <%=userSession.getUser().getFirstName()%> <%=userSession.getUser().getLastName()%>
                | <stripes:link href="/actions/loginout/Logout.action">Logout</stripes:link>
                <%
                    System.out.println(((UserSession<Users,Projects,Svn,DataBases,Schema>)request.getSession().getAttribute(SecurityContext.USER_KEY)).getProject().getDescription());
                %>
                

                <%}%>
            </td>
        </tr>
    </table>
    <div class="urbangreymenu">
        <jsp:include page="menu.jsp"/>
    </div>


</div>